package com.citms.aif.util;

import javax.servlet.http.HttpServletRequest;

import com.citms.aif.model.UserRightViewModel;
import com.citms.aif.service.SysUserService;
import com.citms.aif.util.HttpContextUtils;
import com.citms.aif.util.SpringContextUtils;

public class UserContextHolder {
	
	public static String getUserId() {
		
		UserRightViewModel userInfo = getUserInfo();
		if(userInfo != null){
			return userInfo.getUserCode();
		}else{
			return null;
		}
	}
	
	
	public static UserRightViewModel getUserInfo(){

		SysUserService sysUserService = SpringContextUtils.getBean(SysUserService.class);
		return sysUserService.getUserInfo();
		
	}
	
	public static String getAuthorization(){
		HttpServletRequest req = HttpContextUtils.getHttpServletRequest();	
		return req.getHeader("Authorization");
	}
	
}
